package com.handsome.迭代器模式;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author niechun
 * @date 2023/3/19 13:41
 */
public class InfoCollege implements College{
    private List<Department> departments;
    //数组中元素的个数
    private int quality=0;

    public InfoCollege() {
        departments=new ArrayList<>();
        add(new Department("信息安全",""));
        add(new Department("网络安全",""));
        add(new Department("硬件安全",""));

    }

    @Override
    public String getName() {
        return "信息学院";
    }

    @Override
    public void add(Department department) {
        departments.add(department);
    }

    @Override
    public Iterator getIterator() {
        return new InfoCollegeIterator(departments);
    }
}
